<?php

$lines = file('testresults.txt');
$numitems = count($lines);

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
	$pieces = explode("|",$line);
//	print_r($pieces);
	if($line_num == 0){ 
		$datestamp = trim($pieces[0]);
		$version = trim($pieces[1]); }
	else {
		$status[$line_num] = $pieces[0];
		$testname[$line_num] = $pieces[1];
		$testdesc[$line_num] = $pieces[2];
		$testurl[$line_num] = $pieces[3];
		$testtime[$line_num] = trim($pieces[4]);
//    	echo "Line #<b>{$line_num}</b> Status: " . $status[$line_num] . "<br />\n";
//    	echo "Line #<b>{$line_num}</b> Test Name: " . $testname[$line_num] . "<br />\n";
//    	echo "Line #<b>{$line_num}</b> Test Description: " . $testdesc[$line_num] . "<br />\n";
//    	echo "Line #<b>{$line_num}</b> Test Time: " . $testurl[$line_num] . "<br />\n";
//    	echo "Line #<b>{$line_num}</b> Test Time: " . $testtime[$line_num] . "<br />\n";
	}
}

?>
<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
  	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
  	<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
  <title>aiMatch - Canary Testing</title>
  	<link href="/stylesheets/base_packaged.css" media="screen" rel="stylesheet" type="text/css" />
  	<link href="/stylesheets/compiled/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
  	<link href="/stylesheets/compiled/print.css" media="print" rel="stylesheet" type="text/css" />
  	<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.png"/>
</head>
<body>

<div id="container">
  <div id="header">
    <div id="header-inner">
      <h1 id="title">
        <img alt="view" src="/images/aimatch_canary.jpg" />
      </h1>
      <div id="nav" class="tabs"><ul class="nav"></ul></div>
    </div>
  </div>
  <div id="subnav" class="tabs"><ul></ul></div>
  <div id="main">
    <div id="inner">
    	<div id="flash-wrapper"></div>
    	<div id="content">
      	<h1>All Tests</h1> <b>Test Suite Execution Time:</b>&nbsp;&nbsp;&nbsp;<?php echo date("F j, Y - g:ia",$datestamp); ?>
        	<div id="campaigns">
  				<p class="list-actions right"></p>
  			<div class="filters border_top">
			<b>Canary Binary Version:&nbsp;&nbsp;&nbsp;</b>v<?php echo $version; ?><br>
    <form action="/campaigns" class="formtastic searchlogic_search" method="get"><div><input id="search_order" name="search[order]" type="hidden" value="descend_by_created_at" /></div>
      <fieldset class="inputs"><ol>
      </ol></fieldset>
      <div class="buttons">
      </div>
    </form>
  </div>
  <div class="pagination"></div>

  <table class="record-list">
    <thead>
      <tr>
        <th>Status</th>
        <th>Test Name</th>
        <th>Description</th>
        <th>Test Time</th>
        <th>Archived Tests</th>
      </tr>
    </thead>
    <tbody>
      
<?php        

	$i = 1;
	while ($i < $numitems){
		if($i%2){ $rowclass = "campaign odd"; }
		else { $rowclass = "campaign even"; }

		  echo "<tr class=\"".$rowclass."\">";
          echo "<td class=\"status-".$status[$i]."\">".ucfirst($status[$i])."</td>";
          echo "<td><a href=\"http://tests.aimatch.com/tests/".$testurl[$i]."?web=1\" target=_blank>".$testname[$i]."</a></td>";
          echo "<td>".$testdesc[$i]."</td>";
          echo "<td>".date("n/j/Y g:ia",$testtime[$i])."</td>";
          echo "<td class=\"noclass\"><a href=\"http://tests.aimatch.com/directorylisting/list_".$testurl[$i]."\" target=_blank>Results</a></td>";
          echo "</tr>";
          
	$i++;
	}
          
?>        
        
      
    </tbody>
  </table>
  <br>
<a href="bt_info.php" target=_blank>[Gather Detailed BT Debugging Information]</a>&nbsp;&nbsp;&nbsp; <b>NOTE:</b> This will gather log, cassandra and database information for known BT visitors.<br><br>
<a href="run_all_tests.php" target=_blank>[Execute All Tests in Canary Suite]</a>&nbsp;&nbsp;&nbsp; <b>NOTE:</b> Running all tests will take about 30 minutes to entirely complete.<br><br>
  <div class="pagination"></div>

</div>

    	</div>
		</div>
  </div>

  <div id="footer"></div>
</div>

<div id="ajax-loader">
</div>

</body>
</html>

